// 请求响应参数（不包含data）

import {InternalAxiosRequestConfig} from "axios";
import {RouteRecordRaw, RouteComponent} from "vue-router";
import {TokenInfo, SysUserInfo, Menu, AuthOperation} from "@/interface/api";

export interface Result {
    code: string;
    msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
    data: T;
}

// 分页响应参数
export interface ResPage<T> {
    rows: T[];
    page_num: number;
    page_size: number;
    total: number;
}

export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
    noLoading?: boolean;
}

export type LayoutType = "vertical" | "classic" | "transverse" | "columns";

export type AssemblySizeType = "large" | "default" | "small";

export type LanguageType = "zh" | "en";

export interface GlobalState {
    isMobile: boolean;
    layout: LayoutType;
    assemblySize: AssemblySizeType;
    language: LanguageType;
    isMaximize: boolean;
    primary: string;
    isDark: boolean;
    isGrey: boolean;
    isWeak: boolean;
    asideInverted: boolean;
    headerInverted: boolean;
    isCollapse: boolean;
    accordion: boolean;
    breadcrumb: boolean;
    breadcrumbIcon: boolean;
    showTabs: boolean;
    tabsIcon: boolean;
    showFooter: boolean;
}

export interface AuthState {
    token: TokenInfo | null;
    user: SysUserInfo | null,
    menuList: Menu[];
    showMenuList: Menu[];
    flatMenuList: MenuOptions[];
    breadcrumbList: BreadCrumbs;
    operations: AuthOperation;
}

export interface BreadCrumbs {
    [key: string]: MenuOptions;
}
export interface DynamicRouter {
    name: string;
    title: string;
    path: string;
    component_path: string;
    component: RouteComponent | string;
    params: string;
    redirect: string;
    iframe: boolean;
    link: string;
    keep_alive: boolean;
    full_screen: boolean;
    is_fixed: boolean;
    hidden: boolean;
    meta: {
        icon_name: string;
        title: string;
    },
}

export interface MenuOptions {
    path: string;
    name: string;
    type: number;
    component_path?: string;
    component?: (() => Promise<unknown>);
    redirect?: string;
    meta: MetaProps;
    children?: MenuOptions[];
}
export interface MetaProps {
    icon_type: number;
    icon_name: string;
    title: string;
    link?: string;
    id: number;
    pid: number;
    iframe: boolean;
    hidden: boolean;
    full_screen: boolean;
    is_fixed: boolean;
    keep_alive: boolean;
}

export interface TabsMenuProps {
    icon: string;
    name: string;
    title: string;
    path: string;
    close: boolean;
}

/* TabsState */
export interface TabsState {
    tabsMenuList: TabsMenuProps[];
}

export interface RouterState {
    routeId: string;
    routeName: string;
    dynamicRouteInit: boolean;
    routers: RouteRecordRaw[];
    dynamicRouters: RouteRecordRaw[];
    keepAliveNames: string[];
}

export interface HumanDate {
    year: number,
    month: number,
    day: number,
    week: number | null,
}





